package com.wcs.exam.common.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 考试状态(1:考试中、2:待批改、3:批改中、4:批改完成)
 *
 * @author wcs
 */
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum ExamStatusEnum {

    /**
     * 考试中
     */
    NOT_OVER(1, "考试中", ""),

    /**
     * 待批改
     */
    WAIT_CORRECTED(2, "待批改", ""),

    /**
     * 批改中
     */
    CORRECTING(3, "批改中", ""),

    /**
     * 批改完成
     */
    COMPLETE(4, "批改完成", "");

    /**
     * 编码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String desc;

    /**
     * 描述
     */
    private final String descEn;

    public static ExamStatusEnum byCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ExamStatusEnum examStatusEnum : ExamStatusEnum.values()) {
            if (examStatusEnum.getCode().equals(code)) {
                return examStatusEnum;
            }
        }
        return null;
    }
}
